package com.yun.algorithmproblem.leetcode;

public class Leetcode3340 {

    public boolean isBalanced(String num) {
        int left = 0;
        int right = 0;
        for (int i = 0; i < num.length(); i++) {
            char c = num.charAt(i);
            if (i % 2 == 0) {
                left += c - 48;
            } else {
                right += c - 48;
            }
        }
        return left == right;
    }
}
